import { create } from 'zustand';
import { persist } from 'zustand/middleware';

const ThumbsUpList = create(
    persist(
        (set) => ({
            list: [{}],
            addThumbsUp: (id)=>{
                set((state) => ({list:[...state.list,id]}));
            },
            removeThumbsUp: (id)=>{
                set((state) => ({
                    list:state.list.filter((item)=>item.article!==id.article&item.user!==id.user)}));
            },
        }),
        { name: 'thumbs-up-list' }
    )
);

export default ThumbsUpList;